package org.jeecg.modules.car.mapper;

import com.baomidou.mybatisplus.annotation.SqlParser;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.car.entity.CarMerchant;

import java.util.List;

/**
 * @Description: 商家管理
 * @Author: jeecg-boot
 * @Date:   2020-10-17
 * @Version: V1.0
 */
public interface CarMerchantMapper extends BaseMapper<CarMerchant> {

    List<CarMerchant> findPage(Page<CarMerchant> page, @Param("carMerchant") CarMerchant carMerchant);

    @SqlParser(filter = true)
    CarMerchant getUserByName(String username);

    @SqlParser(filter = true)
    void updateRemainAmount(@Param("carMerchant") CarMerchant carMerchant);

    List<CarMerchant> getMerchantByParkList(@Param("parkId")String parkId);

    @SqlParser(filter = true)
    int updatePwd(@Param("id") String id,@Param("newPwd") String newPwd,@Param("remarks") String remarks);

    @SqlParser(filter = true)
    CarMerchant getSelfById(@Param("id") String merchantId);

    @Update("update car_merchant set donate_amount = 0,update_time = now() ")
    void updateDonate();

    Result<String> giveAllDonateAmonut();
}
